package com.main.modulemysql.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.main.modulemysql.entity.Equipment;
import com.main.modulemysql.mapper.EquipmentMapper;
import com.main.modulemysql.service.IEquipmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author IceZhang
 * @since 2018-08-07
 */
@Service
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements IEquipmentService {

    @Override
    public Integer getEquipmentCountByFacilityCode(String facilityCode) {
        return baseMapper.getEquipmentCountByFacilityCode(facilityCode);
    }

    @Override
    public Integer getFaultEquipmentCountByFacilityCode(String facilityCode) {
        return baseMapper.getFaultEquipmentCountByFacilityCode(facilityCode);
    }

    @Override
    public Integer getEquipmentCountByCateogoryCode(String categoryCode) {
        EntityWrapper<Equipment>entityWrapper=new EntityWrapper<>();
        entityWrapper.eq("category_code",categoryCode);
        return baseMapper.selectCount(entityWrapper);
    }



    @Override
    public List<Equipment> selectPage() {
        Page<Equipment>page=new Page<Equipment>(1,10);
        EntityWrapper<Equipment>entityWrapper=new EntityWrapper<>();
        entityWrapper.like("pile_no", "k");
        //List<Equipment> equipment = baseMapper.selectPage(page, entityWrapper);
        return null;
    }
}
